// 状态 1启用 0未启用
const StatusArray = [
  { value: '0', label: '未启用' },
  { value: '1', label: '启用' }
];

// Summary 直方图类型
const SummaryHistogramArray = [
  { value: 'txh', label: '连接挂起' },
  { value: 'txn', label: '事务执行时间' },
  { value: 'rds_c', label: 'rds耗时' },
  { value: 'rds_s', label: 'rds结果大小' },
  { value: 'es_c', label: 'es查询耗时' },
  { value: 'es_r', label: 'es请求大小' },
  { value: 'es_s', label: 'es结果大小' },
  { value: 'cost', label: '请求耗时' },
];

// Sql 直方图类型
const SqlHistogramArray = [
  { value: 'cost', label: '耗时' },
  { value: 'hold', label: '等待' },
  { value: 'select', label: '查询行数' },
  { value: 'update', label: '更新行数' },
];

// Url 直方图类型
const UrlHistogramArray = [
  { value: 'cost', label: '耗时' },
];

const JobStatusMapper = {
  'OK': { label: '正常', color: '#52c41a' },
  'CRASHED': { label: '异常', color: '#f5222d' },
  'DISABLED': { label: '禁用', color: '#faad14' },
  'SHARDING_FLAG': { label: '分片', color: '#52c41a' },
  'error': { label: '未知', color: '#f5222d' },
}

// compareRule equal|greater_than|greater_than_or_equal|less_than|less_than_or_equal|contains|contains_for|regex|exists|not_exists
const CompareRuleArray = [
  { value: 'equal', label: '相等', description: 'equal-监控数据等于预期值' },
  { value: 'greater_than', label: '大于', description: 'greater_than-监控数据大于预期值' },
  { value: 'greater_than_or_equal', label: '大于等于', description: 'greater_than_or_equal-监控数据大于等于预期值' },
  { value: 'less_than', label: '小于', description: 'less_than-监控数据小于预期值' },
  { value: 'less_than_or_equal', label: '小于等于', description: 'less_than_or_equal-监控数据小于等于预期值' },
  { value: 'contains', label: '包含', description: 'contains-监控值包含预期值' },
  { value: 'contains_for', label: '被包含', description: 'contains_for-预期值包含监控值' },
  { value: 'regex', label: '正则匹配', description: 'regex-预期值是正则表达式，监控值匹配这个正则表达式' },
  { value: 'exists', label: '存在', description: 'exists-监控值存在' },
  { value: 'not_exists', label: '不存在', description: 'not_exists-监控值不存在' },
];

const CompareRuleMapper = {
  'equal': { label: '相等', description: 'equal-监控数据等于预期值' },
  'greater_than': { label: '大于', description: 'greater_than-监控数据大于预期值' },
  'greater_than_or_equal': { label: '大于等于', description: 'greater_than_or_equal-监控数据大于等于预期值' },
  'less_than': { label: '小于', description: 'less_than-监控数据小于预期值' },
  'less_than_or_equal': { label: '小于等于', description: 'less_than_or_equal-监控数据小于等于预期值' },
  'contains': { label: '包含', description: 'contains-监控值包含预期值' },
  'contains_for': { label: '被包含', description: 'contains_for-预期值包含监控值' },
  'regex': { label: '正则匹配', description: 'regex-预期值是正则表达式，监控值匹配这个正则表达式' },
  'exists': { label: '存在', description: 'exists-监控值存在' },
  'not_exists': { label: '不存在', description: 'not_exists-监控值不存在' },
  'error': { label: '未知', description: '不支持的比较规则' },
};

// any|change|frequency|flatline|spike
const NotificationRuleArray = [
  { value: 'any', label: 'any-只要有监控项匹配就会发送告警通知', description: '只要有监控项匹配就会发送告警通知' },
  { value: 'change', label: 'change-监控项数据发生变化才发送告警通知', description: '监控项数据发生变化才发送告警通知' },
  { value: 'frequency', label: 'frequency-根据监控项匹配频率发送告警通知', description: '根据监控项匹配频率发送告警通知' },
  { value: 'flatline', label: 'flatline-根据监控项匹配持续时间发送通知', description: '根据监控项匹配持续时间发送通知' },
  // { value: 'spike', label: '', description: '' },
];

const TimeUnitArray = [
  { value: 'second', label: '秒' },
  { value: 'minute', label: '分钟' },
  { value: 'hour', label: '小时' },
  // { value: 'day', label: '天' },
  // { value: 'week', label: '周' },
  // { value: 'month', label: '月' },
];

// method GET|POST
const HttpMethodArray = [
  { value: 'GET', label: 'GET' },
  { value: 'POST', label: 'POST' },
];

// notificationType email|sms|i9_message
const NotificationTypeArray = [
  { value: 'email', label: '邮件通知' },
  { value: 'sms', label: '短信通知' },
];

const NotificationTypeMapper = {
  'email': { label: '邮件通知' },
  'sms': { label: '短信通知' },
  'error': { label: '未知' },
};

export {
  StatusArray,
  SummaryHistogramArray,
  SqlHistogramArray,
  UrlHistogramArray,
  JobStatusMapper,
  CompareRuleArray,
  CompareRuleMapper,
  NotificationRuleArray,
  TimeUnitArray,
  HttpMethodArray,
  NotificationTypeArray,
  NotificationTypeMapper,
};
